<template>
	<!-- 我的面值 -->
	<view class="myCalendar">

	<!-- 	<view class="bg_top" :style="'height:'+(2*menuButtonInfo.top+48)+'rpx'"></view>
		<view class="top z_index" :style="'padding-top:'+ (menuButtonInfo.top+5) + 'px'">
			<u-icon @click="goNavigateBack" class="top_icon" name="arrow-left" color="#000000" size="40"></u-icon>
			<view class="top_title"></view>
		</view> -->

		<!-- <view class="falls" :style="{paddingTop:(2*menuButtonInfo.top +60)+'rpx'}"> -->
		<view class="falls">
			<view class="CalendarHeard">
				<view class="heardTitle">我的面值</view>
				<h3>{{face}}</h3>
			</view>
			<!-- calc(100vh - 434rpx); -->
			<!-- <view class="CalendarBody" :style="{height:`calc(${100}vh - ${(2*menuButtonInfo.top +60+20+260)}rpx)`}"> -->
			<view class="CalendarBody" :style="{height:`calc(${100}vh - ${(60+20+260)}rpx)`}">
				<view class="BodyHeard">面值记录</view>
				<view class="BodyBox" v-if="userCoinLogs.length != 0">
					<view class="BoxItems" v-for="(item,index) in userCoinLogs" :key="index" @click="ffBottom(item)">
						<view class="ItemsTop">
							<span>{{item.desc}}</span>
							<span>{{item.coin}}</span>
						</view>
						<view class="ItemsBottom">{{$Tools.setDate(item.createTime,1)}}</view>
					</view>
				</view>
				<empty v-else title="暂无记录"></empty>
			</view>
		</view>
		
		<!-- 弹出层 -->
		<u-popup v-model="isBottom" mode="bottom">
				<view class="BottomBox">
					<view  class="BottomBoxTitle">
						<span>记录详情</span>
						<image src="../../../static/chacha.png" @click="isBottom = false"></image>
					</view>
					<view  class="BottomBoxBody">
						{{bottomItem.desc}}
					</view>
				</view>
		</u-popup>

	</view>
</template>
<script>
	import empty from "@/components/defaultpage/empty.vue"
	export default {
		data() {
			return {
				// menuButtonInfo: {
				// 	top: 25
				// },
                userCoinLogs: [],
				face: 0,
				isBottom: false,
				bottomItem: {}
			}
		},
		components:{
			empty,
			},
		onLoad(params) {
			this.face = params.face;
			// debugger
			this.init()
		},
		onShow(){
			this.userCoinLoglist();
		},
		methods: {
			ffBottom(item){
				this.isBottom = true;
				this.bottomItem = item;
			},
			init() {
				// // debugger
				// // #ifndef H5 || APP-PLUS || MP-ALIPAY
				// this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
				// // #endif
				
			},
			goNavigateBack() {
				uni.navigateBack()
			},
			userCoinLoglist(){
				this.$apis.userCoinLogList().then(res=>{
					if(res.code == 200){
						let news =  res.rows;
						news.forEach(item=>{
							if(item.coin > 0){
								// debugger
								item.coin = `+${item.coin}`
							}
							
						})
						this.userCoinLogs = news
						// debugger
						
					}
				})
			}
			
		}
	}
</script>

<style lang="scss">
	.myCalendar {
		min-height: 100vh;
		background: #f5f6f8;

		.CalendarHeard {
			display: flex;
			height: 260rpx;
			flex-direction: column;
			justify-content: center;
			background: #fff;

			h3 {
				font-size: 72rpx;
				font-family: nominal;
				font-weight: 700;
				text-align: CENTER;
				color: #f10200;
			}
		}

		.CalendarBody {
			background: #fff;
			padding: 40rpx;
			padding-right: 0;
			box-sizing: border-box;
			margin-top: 20rpx;
		}



		.BodyHeard {
			font-size: 36rpx;
			font-family: Source Han Sans CN, Source Han Sans CN-Bold;
			font-weight: 700;
			text-align: LEFT;
			color: #2d3034;
			line-height: 50rpx;
			height: 60rpx;
		}

		.BodyBox {
			height: calc(100% - 60rpx);
			// background: #360;
			overflow: scroll;
		}

		.BoxItems {
			    border-bottom: 4rpx solid #f5f6f8;
			    padding: 25rpx 0px 20rpx;
		}

		.ItemsTop {
			display: flex;
			padding-right: 40rpx;
			 margin-bottom: 5rpx;

			span:nth-child(1) {
				flex: 4;
				font-size: 30rpx;
				font-family: Source Han Sans CN, Source Han Sans CN-Normal;
				font-weight: Normal;
				text-align: LEFT;
				color: #2d3034;
			}

			span:nth-child(2) {
				flex: 1;
				font-size: 15px;
				font-family: nominal;
				font-weight: SemiBold;
				text-align: RIGHT;
				color: #2d3034;
			}
		}
		
		// <u-popup v-model="isBottom" mode="bottom">
		// 		<view class="BottomBox">
		// 			<view  class="BottomBoxTitle">
		// 				<span>记录详情</span>
		// 				<image src="../../../static/chacha.png"></image>
		// 			</view>
		// 			<view  class="BottomBoxBody">
		// 				参与「活动标题活动标题活动标题活动标题活动标题活动」活动获得
		// 			</view>
		// 		</view>
		// </u-popup>
		.BottomBox{
			padding: 30rpx 40rpx 60rpx;
			span{
				font-size: 36rpx;
				font-family: Source Han Sans SC, Source Han Sans SC-Bold;
				font-weight: 700;
				text-align: LEFT;
				color: #2d3034;
			}
			image{
				width: 48rpx;
				height: 48rpx;
			}
		}
		.BottomBoxTitle{
			
			    display: flex;
			    justify-content: space-between;
			    align-items: center;
			    margin-bottom: 60rpx;

		}
		.BottomBoxBody{
			font-size: 18px;
			font-family: Source Han Sans SC, Source Han Sans SC-Bold;
			font-weight: 700;
			text-align: LEFT;
			color: #2d3034;
			 margin-bottom: 60rpx;
		}

		.ItemsBottom {
			font-size: 26rpx;
			font-family: Montserrat, Montserrat-Regular;
			font-weight: 400;
			text-align: JUSTIFIED;
			color: #909499;
			height: 40rpx;
			line-height: 40rpx;

		}

		.heardTitle {
			font-size: 30rpx;
			font-family: Source Han Sans CN, Source Han Sans CN-Bold;
			font-weight: 700;
			text-align: CENTER;
			color: #2d3034;
		}

		.bg_top {
			width: 750rpx;
			background-color: #ffffff;
			position: fixed;
			z-index: 9;
		}

		.z_index {
			z-index: 10;
		}

		.top {
			width: 750rpx;
			height: 48rpx;
			background-color: #FFFFFF;
			position: fixed;
			padding-bottom: 20rpx;
		}

		.top_icon {
			margin-left: 32rpx;
			display: inline-block;
		}

		.top_title {
			position: absolute;
			font-size: 34rpx;
			font-weight: 500;
			line-height: 48rpx;
			display: inline-block;
			left: 50%;
			transform: translate(-50%);
		}

	}
</style>
